package cn.ncupyh.soft;

public class PhoneTest {
    public static void main(String[] args) {
//        创建对象
        Phone[] arr = new Phone[3];
        Phone p1 = new Phone("小米",10,"黑色");
        Phone p2 = new Phone("华为",20,"蓝色");
        Phone p3 = new Phone("oppo",30,"白色");

//        赋值
        arr[0] = p1;
        arr[1] = p2;
        arr[2] = p3;

//        求平均值
        double aver = 0;
        for (int i = 0; i < arr.length; i++) {
            aver += arr[i].getPrice();
        }
        aver /= arr.length;
        System.out.println("平均值为:" + aver);
    }
}
